from codex import * import random from time import sleep #Define Menu def menu(): display.clear() display.print("~~ Menu ~~") display.print("Press A- Begin Game") display.print("Press B- End Game") display.print() while True: if buttons.was_pressed(BTN_A): storyIntro() if buttons.was_pressed(BTN_B): endGame() break #Define variables for StoryIntro aList = ["poke", "fight", "battle", "throw rocks", "bully monster"] bList = ["hide", "crawl up in fetal position", "run away", "create distraction"] #Beginning of story frame to print to screen def storyIntro(): display.print("Welcome to Sarah's House of Horrors") sleep(1) display.print() display.print("You will have to be very clever to escape") sleep(1) display.print("Watch out for the villainous monster...") sleep(2) display.clear() display.print("Choose your first action to defeat the monster: ") display.print("Press L- to Fight; Press R- to Hide") while True: if buttons.was_pressed(BTN_L): display.clear() num = random.randrange(4) action1 = aList[num] display.print("You have chosen to Fight!") sleep(1) display.print("You " + action1 + " at the monster and have a direct hit!") sleep(1) display.print("Now. Run!") storyPartTwo() if buttons.was_pressed(BTN_R): display.clear() num = random.randrange(4) action1 = bList[num] display.print("You have chosen to HIDE!") sleep(1) display.print("You " + action1 + " from the monster and he exits the room.") sleep(1) display.print("Now. Run!") storyPartTwo() #Define variables for StoryPart2 cList = ["play dead", "sleep", "sing", "tickle"] dList = ["fight", "insult monster", "text friend", "sword fight"] #Story Part 2 def storyPartTwo(): display.clear() display.print("You escaped the first room. Continue on to Room 2...") sleep(2) display.print() display.print("As you are walking through the door,") display.print("the monster attacks!") sleep(2) display.print display.print("Will your FIGHT or HIDE this time?") sleep(2) display.clear() display.print("Choose your next action to defeat the monster:") display.print("Press L- to Fight; Press R- to Hide") while True: if buttons.was_pressed(BTN_L): display.clear() num = random.randrange(4) action2 = dList[num] display.print("You have chosen to Fight!") sleep(2) display.print("You " + action2 + " at the monster and have a direct hit!") sleep(2) display.print("Now. Run!") winGame() if buttons.was_pressed(BTN_R): display.clear() num = random.randrange(4) action2 = cList[num] display.print("You have chosen to HIDE!") sleep(2) display.print("You " + action2 + " from the monster and he finds you and ATTACKS") sleep(2) endGame() #win Game def winGame(): display.clear() display.print("You DEFEATED the monster!") sleep(2) display.print() display.print("You WIN!!!!", scale=3, color=BLUE) while True: break #End of Game def endGame(): display.clear() display.print("You chose poorly.") display.print() display.print("GAME OVER.", scale=3, color=BLUE) while True: break #Main Program menu()